/*
 * Copyright (c)e 2024-2024.Powered by 清明雨揽月
 * This software is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef DATASTRUCTURES_SEQUENCE_STRING_H
#define DATASTRUCTURES_SEQUENCE_STRING_H
#define MAX_LENGTH 255

#include "iostream"

using namespace std;

typedef struct S_STRING
{
    char ch[MAX_LENGTH];
    int length = MAX_LENGTH;
} s_string;

class SEQUENCE_STRING
{
public:
    void operate();

    void str_assign();

    void str_copy() const;

    bool str_empty() const;

    int str_compare(const S_STRING* data) const;

    int str_length() const;

    void sub_string();

    void concat();

    int index(const S_STRING* t) const;

    void clear_string() const;

    void destroy_string() const;

    int index_kmp(const S_STRING* t, const int next[]) const;

    void get_next(const S_STRING* t, int next[]) const;

private:
    S_STRING* _s_string = new S_STRING();
    S_STRING* _t_string = new S_STRING();
    char _arr[MAX_LENGTH] = {'a', 'b', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'c', 'b', 'a', 'b'};
    char _arr_test[MAX_LENGTH] = {'a', 'b', 'c', 'a', 'c'};
};

#endif // DATASTRUCTURES_SEQUENCE_STRING_H
